import this
from typing import List


def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
    for i in range(0, len(matrix), 1):
        left, right = 0, len(matrix[i]) - 1
        while left < right:
            mid = left + (right - left) // 2
            if matrix[i][mid] == target:
                return True
            elif matrix[i][mid] < target:
                left = mid + 1
            else:
                right = mid
    return False


arr = [[1, 4, 7, 11, 15], [2, 5, 8, 12, 19], [3, 6, 9, 16, 22], [10, 13, 14, 17, 24], [18, 21, 23, 26, 30]]
print(searchMatrix(this, arr, 5))
